#include    "ltsh.h"

int main(int argc, char *argv[])
{
	char	buf[MAXLINE];
	char	*list[MAX_ARGS] = {0};
	JobList	*job_list[MAX_JOBS];
	unsigned int flag;

	init_env();
	init_shell();

	while (true) {
		pr_prompt();

		if (fgets(buf, MAXLINE, stdin) == NULL)
			break;

		parse_line(buf, list, &flag);

		if (list[0] == NULL)
			continue;

		if (builtin(list[0]))
			do_builtin(list);
		else
			do_fork(list, flag, job_list);

		free_list(list);
	}

	return 0;
}
